<template>
	<view class="box">
		<view class="card" v-for="(item,index) in list" :key="index">
			<view class="title">
				<view class="" >
					{{item.make_item.title}}
				</view>

				<view class="" style="font-size: 24rpx;color: #999;">
					{{item.order_sn}}
				</view>
			</view>
			<view class="status" style="font-size: 24rpx;color: #666;">
				状态:{{item.status==1?'进行中':'已完成'}}
			</view>
			<view class="row">
				{{item.remark}}
			</view>

			<view class="images">
					<image :src="$BASE_URL + i" mode="aspectFill" v-for="(i,x) in item.images.split(',')" v-if="item.images"></image>
			</view>
			<view class="time">
				{{timerreturn(item.createtime)}}
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: []
			}
		},
		mounted() {
			this.getlist()
		},
		methods: {
			getlist() {
				this.$http('user.Complaintlist').then(res => {
					console.log(res);
					if (res.code == 1) {
						this.list = [...this.list, ...res.data.list.data]
					}
				})
			},
			timerreturn(timestamp) {
				var date = new Date(timestamp * 1000); //时间戳为10位需*1000，时间戳为13位的话不需乘1000
				let Y = date.getFullYear() + '-';
				let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
				let D = date.getDate() + ' ';
				let h = date.getHours() + ':';
				let m = date.getMinutes() + ':';
				let s = date.getSeconds();
				return Y + M + D + h + m + s;
				

			}

		}
	}
</script>

<style scoped lang="scss">
	.box {
		padding: 20rpx;
		box-sizing: border-box;
		min-height: 100vh;
		background-color: #f6f6f6;
	}

	.card {
		padding: 20rpx;
		box-sizing: border-box;
		background-color: #fff;
		border-radius: 20rpx;
		margin-bottom: 20rpx;

		.title {
			display: flex;
			justify-content: space-between;
			margin-bottom: 20rpx;
		}

		.status {
			margin-bottom: 20rpx;
		}

		.images {
			margin-bottom: 20rpx;
			// width: 160rpx;
			// height: 160rpx;
			display: flex;
			image {
				width: 160rpx;
				height: 160rpx;
			}
		}

		.row {
			margin-bottom: 20rpx;
			font-size: 24rpx;color: #999;
		}

		.time {
			margin-bottom: 20rpx;
			font-size: 24rpx;color: #999;
		}
	}
</style>
